home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbpacket.zip
/
EXPENSE2.BAS
< prev
next >
Wrap
BASIC Source File
|
1991-10-06
|
4KB
|
146 lines
REM-EXPENSE ACCOUNTER (EXPENSE2.BAS)
REM-This program is an expense account.
REM-You can input expenses by category, and display the total.
REM-Initialization section
CLS
S = 200
DIM Catgry(1 TO S), Day$(1 TO S), Desc$(1 TO S), Amt(1 TO S)
Maxmenu = 4
DIM Bigname$(Maxmenu), Littlename$(Maxmenu)
Firstpass = 1
Printimage$ = "$$#####,.##"
REM-Wait for a menu selection
WHILE N < S
PRINT
REM-Show the menu
PRINT "EXPENSE-ACCOUNTER": PRINT
PRINT "What category of expense?"
PRINT 1; "- Food"
PRINT 2; "- Transportation"
PRINT 3; "- Lodging"
PRINT 4; "- Miscellaneous"
PRINT : PRINT Maxmenu + 1; "to print the total"
PRINT Maxmenu + 2; "to exit"
REM-Branch to correct subroutine
INPUT "Input your choice ", N
ON N GOSUB Food, Transport, Lodging, Misc
IF N = Maxmenu + 1 THEN GOSUB Totals
IF N = Maxmenu + 2 THEN GOTO Cleanup
CLS
IF N < 1 OR N > Maxmenu + 2 THEN
PRINT
PRINT "Choose menu numbers 1 through"; Maxmenu + 2
PRINT
END IF
WEND
PRINT "Expense table full. Your totals will be printed"
GOSUB Waityes
GOSUB Totals
END
Food:
CLS
Bigname$(N) = "FOOD"
Littlename$(N) = "food"
PRINT Bigname$(N)
GOSUB General 'Call general input subroutine
RETURN
Transport:
CLS
Bigname$(N) = "TRANSPORTATION"
Littlename$(N) = "transportation"
PRINT Bigname$(N)
GOSUB General 'Call general input subroutine
RETURN
Lodging:
CLS
Bigname$(N) = "LODGING"
Littlename$(N) = "lodging"
PRINT Bigname$(N)
GOSUB General 'Call general input subroutine
RETURN
Misc: REM-Subroutine for miscellaneous expense
CLS
Bigname$(N) = "MISCELLANEOUS"
Littlename$(N) = "miscellaneous"
PRINT Bigname$(N)
GOSUB General 'Call general input subroutine
RETURN
General: REM-General input subroutine
I = I + 1
Catgry(I) = N
IF Firstpass = 1 THEN
REM-Lines to handle date input for first run of program
INPUT "Input date ", Day$(I)
D$ = Day$(I)
Firstpass = 0
ELSEIF Firstpass = 0 THEN
REM-Ordinary case; not first run of program
PRINT "Last date was "; D$
PRINT "Press Enter to use this date"
INPUT "or input new date"; Day$(I)
IF Day$(I) = "" THEN Day$(I) = D$
D$ = Day$(I)
END IF
INPUT "Description: ", Desc$(I)
INPUT "Amount: ", Amt(I)
RETURN
Totals: REM-Subroutine to print totals
CLS
FOR N = 1 TO Maxmenu
IF N = 1 THEN PRINT TAB(20); "EXPENSE REPORT"
PRINT : PRINT TAB(20); Bigname$(N)
PRINT
PRINT "Date:"; TAB(20); "Description"; TAB(45); "Amount"
PRINT
FOR J = 1 TO I
IF Catgry(J) = N THEN
PRINT Day$(J); TAB(20); Desc$(J); TAB(40);
PRINT USING Printimage$; Amt(J)
Subtotal = Subtotal + Amt(J)
Grandtotal = Grandtotal + Subtotal
END IF
NEXT J
PRINT : PRINT TAB(10); "Expenses for ";
PRINT Littlename$(N); TAB(40);
PRINT USING Printimage$; Subtotal
Subtotal = 0 'Reset subtotal
GOSUB Waityes 'Call subroutine to wait for answer
NEXT N
REM-Print grand total
PRINT : PRINT TAB(10); "GRAND TOTAL:";
PRINT TAB(40);
PRINT USING Printimage$; Grandtotal
PRINT
WHILE A$ <> "Y" AND A$ <> "y"
INPUT "Return to menu (y/n)"; A$
WEND
RETURN
Waityes:
REM-Subroutine to wait for a "Y" or "y" answer
PRINT
WHILE A$ <> "Y" AND A$ <> "y"
INPUT "Show next (y/n)"; A$
WEND
A$ = ""
RETURN
Cleanup:
REM-Routine to clean up screen and exit
CLS
PRINT "Program terminated"
END